<!doctype html>
<html class="no-js">
    <head>
        <include file="common/head"/>
    </head>
    <body>
        <include file="common/header"/>
        <div class="am-cf admin-main">
            <!-- sidebar start -->
            <include file="common/sidebar"/>
            <!-- sidebar end -->

            <!-- content start -->
            <div class="admin-content">

                <div class="am-cf am-padding">
                    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">表单</strong> / <small>form</small></div>
                </div>

                <div class="am-tabs am-margin" data-am-tabs>
                    <ul class="am-tabs-nav am-nav am-nav-tabs">
                        <li class="am-active"><a href="#tab1">基本信息</a></li>
                    </ul>
                    <div class="am-tabs-bd">
                        <div class="am-tab-panel am-fade am-active am-in" id="tab1">
                            <form class="am-form">
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">所属类别</div>
                                    <div class="am-u-sm-8 am-u-md-10">
                                        <select data-am-selected="{btnSize: 'sm'}" name="parentId">
                                            <option value="0">父级</option>
                                            <foreach name="categories" item="c">
                                                <option value="{$c.id}" <eq name="c.id" value="$category.parentId">selected</eq>>{$c.name}</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">显示状态</div>
                                    <div class="am-u-sm-8 am-u-md-10">
                                        <div class="am-btn-group" data-am-button>
                                            <label class="am-btn am-btn-default am-btn-xs <eq name='category.status' value='enable'>am-active</eq>">
                                                <input type="radio" name="status" id="option1" value="enable" <eq name="category.status" value="enable">checked="true"</eq>> 正常
                                            </label>
                                            <label class="am-btn am-btn-default am-btn-xs <eq name='category.status' value='disable'>am-active</eq>">
                                                <input type="radio" name="status" id="option3" value="disable"<eq name="category.status" value="disable">checked="true"</eq>> 不显示
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">推荐类型</div>
                                    <div class="am-u-sm-8 am-u-md-10">
                                        <div class="am-btn-group" data-am-button>
                                            <label class="am-btn am-btn-default am-btn-xs">
                                                <input type="checkbox" name="siNavi" value="true"> 首页导航
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        分类标题
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4">
                                        <input type="text" class="am-input-sm" name="name" value="{$category.name}">
                                    </div>
                                    <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                                </div>

                                <div class="am-g am-margin-top">
                                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                        分类别名
                                    </div>
                                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                                        <input type="text" class="am-input-sm" name="alias" value="{$category.alias}">
                                    </div>
                                </div>
                                <input type="hidden" name="id" value="{$category.id}"/>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="am-margin">
                    <button type="button" class="am-btn am-btn-primary am-btn-xs" id="submit">提交保存</button>
                    <button type="button" class="am-btn am-btn-primary am-btn-xs" id="cancel">放弃保存</button>
                </div>
            </div>
            <!-- content end -->

        </div>
        <include file="common/footer"/>
        <script>
            $(function () {
                var submit = $("#submit"), cancel = $("#cancel");
                submit.on("click", function(e){
                    e.stopPropagation();
                    var param = $("form").formToJson();
                    $.post("{$Think.LINK}/category/save.html",param,function(e){
                        console.log(e);
                    });
                    console.log(param);
                });

            });
        </script>
    </body>
</html>
